<template>
  <div class="box">
    <header class="header feed-header">
      <mt-header title="喂养">
        <router-link to="/products" slot="left">
          <mt-button icon="back"></mt-button>
        </router-link>
        <mt-button class="iconfont icon-ai-search" slot="right"></mt-button>
      </mt-header>
    </header>
    <div class="feed-content">
      <ul>
        <li v-for="(item, index) in feedlist" :key="index">
          <img :src="item.media" alt="">
          <p>{{item.proname}}</p>
          <span>会员价￥{{item.vprice}}</span>
        </li>
        <li @click="toDetail">
          <img src="./../../assets/baby4.jpg" alt="">
          <p>1片吸干6次尿</p>
          <span>会员价￥999</span>
        </li>
        <li @click="toDetail">
          <img src="./../../assets/baby4.jpg" alt="">
          <p>1片吸干6次尿</p>
          <span>会员价￥999</span>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import axios from 'axios'
import Qs from 'qs'
import Vue from 'vue'
import { Search } from 'mint-ui'
Vue.component(Search.name, Search)
export default {
  data () {
    return {
      feedlist: []
    }
  },
  created () {
    let data2 = {
      token: '7qwN83Y2xI2xasQikfLHvwFwLQKxxk5wZyi6Ej+So2Vx1864is3FP2c+zr18HzNAC7fzHZHbmLDWwJraATqJ+cjyp9aSekyCKPoiVit0kHqEJYNu3/HhVAqSW1YJBo9GtG4aH2RSdJ194HC4Slo8wLMBKgvd61ZSGeyJJ80HEnPtUff6/csmpBFsSlXoVRN+DygYwJsRRi2im1HkL0zDJr9GL1nJSxfJLr2+3dEGuEGyDJYuS6aGVaSzY7BCGX2OBspUNJw5BuYR/t3hvUWPCYbfCSehfNHALihJVTJ39LLJ9d/uyc4ciyBA5ZbusTst',
      tid: 2,
      pageNum: 1,
      pageSize: 5
    }
    // 商品区
    axios({
      method: 'post',
      url: 'http://47.99.223.44:8081/productbytid.do',
      data: Qs.stringify(data2)
    })
      .then((res) => {
        console.log(res)
        const obj = res.data.list
        this.feedlist = obj
        console.log(this.feedlist)
      })
      .catch(function (error) {
        console.log(error)
      })
  },
  methods: {
    toDetail () {
      this.$router.push('/prodetail')
    }
  }
}
</script>

<style lang="scss">
@import '@/lib/reset.scss';
.header, .feed-header {
  @include rect(100%, 0.4rem);
  text-align: center;
  box-shadow: 0px 0px 0px 0px rgba(255, 255, 255, 1);
  font-family: Arial;
  border: 1px solid rgba(255, 255, 255, 0);
  border: none;
  .mint-header {
    // background-color: rgb(226, 226, 226);
    height: 100%;
    background-color: #ACEBDB;
    h1, .mint-header-button{
      color: rgba(100, 100, 100, 1);
      font-size: 0.16rem;
      .mintui-back {
        font-weight: 900;
      }
    }
  }
}

// 列表
.feed-content {
  @include rect(100%, 100%);
  overflow-y: auto;
  ul {
    @include rect(88%, 100%);
    margin-left: 5%;
    margin-top: 0.2rem;
    li {
      float: left;
      @include flexbox();
      @include flex-direction(column);
      @include justify-content();
      @include align-items();
      margin-left: 0.12rem;
      margin-bottom: 0.2rem;
      font-size: 0.12rem;
      img {
         @include rect(1.52rem, 1.52rem);
        border-radius: 0.08rem;
        border: 1px solid rgba(187, 187, 187, 1);
      }
      p {
        margin-top: 0.05rem;
        width: 0.86rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }
}

</style>
